import httpInstance from "@/utils/http"

// 获取商品详情数据
export const getDetailAPI = (id) => {
  return httpInstance({
    url: '/goods',
    params: {
      id
    }
  })
}

// 获取商品详情库存信息
export const getGoodsStockDetailAPI = (skuId) => {
  return httpInstance({
    url: `/goods/stock/${skuId}`,
  })
}

/**
 * 获取热榜商品
 * @param {Number} id - 商品id
 * @param {Number} type - 1代表24小时热销榜 2代表周热销榜
 * @param {Number} limit - 获取个数
 */
export const getHotGoodsAPI = ({ id, type, limit = 3 }) => {
  return httpInstance({
      url: '/goods/hot',
      params: {
          id,
          type,
          limit
      }
  })
}

